package wcg;

import javax.swing.JPanel;
import java.awt.Frame;
import java.awt.Point;

import javax.swing.JDialog;
import javax.swing.JSlider;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import java.awt.Dimension;
import javax.swing.JTextField;
import javax.swing.JToggleButton;

public class winchkOption extends JDialog {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JSlider jSliderDisplayLevel = null;
	private JLabel jLabel = null;
	private JLabel jLabelDisplayLevelHi = null;
	public int DisplayLevel=0;
	public boolean Ok = false;
	public boolean NotCheckInterFiles = false;
	//public int Port = 7200;
	private JButton jButtonOK = null;
	private JButton jButtonCancel = null;
	private JLabel jLabelDisplayLevelHi1 = null;
	private JCheckBox jCheckBoxNoCheckInterFiles = null;
	/**
	 * @param owner
	 */
	public winchkOption(Frame owner) {
		super(owner);
		initialize();
		Point p = owner.getLocation();
		setLocation(p.x+100,p.y+50);

	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(336, 178);
		this.setTitle("Option ");
		this.setContentPane(getJContentPane());
		this.addWindowListener(new java.awt.event.WindowAdapter() {
			public void windowClosing(java.awt.event.WindowEvent e) {
				System.out.println("windowClosing()"); 
			}
		});
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jLabelDisplayLevelHi1 = new JLabel();
			jLabelDisplayLevelHi1.setBounds(new Rectangle(255, 15, 39, 16));
			jLabelDisplayLevelHi1.setText(">Detail");
			jLabelDisplayLevelHi = new JLabel();
			jLabelDisplayLevelHi.setBounds(new Rectangle(180, 15, 55, 16));
			jLabelDisplayLevelHi.setText("Silent<");
			jLabel = new JLabel();
			jLabel.setText("Check message Level");
			jLabel.setBounds(new Rectangle(15, 15, 151, 31));
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getJSliderDisplayLevel(), null);
			jContentPane.add(jLabel, null);
			jContentPane.add(jLabelDisplayLevelHi, null);
			jContentPane.add(getJButtonOK(), null);
			jContentPane.add(getJButtonCancel(), null);
			jContentPane.add(jLabelDisplayLevelHi1, null);
			jContentPane.add(getJCheckBoxNoCheckInterFiles(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jSliderDisplayLevel	
	 * 	
	 * @return javax.swing.JSlider	
	 */
	private JSlider getJSliderDisplayLevel() {
		if (jSliderDisplayLevel == null) {
			jSliderDisplayLevel = new JSlider();
			jSliderDisplayLevel.setBounds(new Rectangle(180, 30, 121, 31));
			jSliderDisplayLevel.setMaximum(3);
			jSliderDisplayLevel.setMinimum(0);
			jSliderDisplayLevel.setMajorTickSpacing(1);
			jSliderDisplayLevel.setMinorTickSpacing(1);
			jSliderDisplayLevel.setPaintTicks(true);
			jSliderDisplayLevel.setSnapToTicks(true);
			
			jSliderDisplayLevel.addChangeListener(new javax.swing.event.ChangeListener() {
				public void stateChanged(javax.swing.event.ChangeEvent e) {
					DisplayLevel = jSliderDisplayLevel.getValue();
				}
			});
		}
		return jSliderDisplayLevel;
	}
	/**
	 * set value of the dialog
	 * @return none
	 * 
	 */
	public void setValue(){
		jSliderDisplayLevel.setValue(DisplayLevel);
		jCheckBoxNoCheckInterFiles.setSelected(NotCheckInterFiles);
		//jTextFieldPort.setText(String.format("%d", Port));
	}
	/**
	 * This method initializes jButtonOK	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButtonOK() {
		if (jButtonOK == null) {
			jButtonOK = new JButton();
			jButtonOK.setBounds(new Rectangle(213, 102, 89, 25));
			jButtonOK.setText("OK");
			jButtonOK.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					Ok=true;
					//String str = jTextFieldPort.getText();
					int pt;
					try{
						//pt = Integer.parseInt(str);
						//Port = pt;
					}catch(NumberFormatException ex){
						System.err.println(ex);
					}
					dispose();
				}
			});
		}
		return jButtonOK;
	}

	/**
	 * This method initializes jButtonCancel	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButtonCancel() {
		if (jButtonCancel == null) {
			jButtonCancel = new JButton();
			jButtonCancel.setBounds(new Rectangle(107, 102, 89, 24));
			jButtonCancel.setText("Cancel");
			jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					dispose();
				}
			});
		}
		return jButtonCancel;
	}

	/**
	 * This method initializes jCheckBoxNoCheckInterFiles	
	 * 	
	 * @return javax.swing.JCheckBox	
	 */
	private JCheckBox getJCheckBoxNoCheckInterFiles() {
		if (jCheckBoxNoCheckInterFiles == null) {
			jCheckBoxNoCheckInterFiles = new JCheckBox();
			jCheckBoxNoCheckInterFiles.setBounds(new Rectangle(15, 60, 286, 31));
			jCheckBoxNoCheckInterFiles.setText("Don't Check time continuum between files");
			jCheckBoxNoCheckInterFiles
					.addChangeListener(new javax.swing.event.ChangeListener() {
						public void stateChanged(javax.swing.event.ChangeEvent e) {
						}
					});
			jCheckBoxNoCheckInterFiles
					.addActionListener(new java.awt.event.ActionListener() {
						public void actionPerformed(java.awt.event.ActionEvent e) {
							NotCheckInterFiles = jCheckBoxNoCheckInterFiles.isSelected();
						}
					});
		}
		return jCheckBoxNoCheckInterFiles;
	}
}  //  @jve:decl-index=0:visual-constraint="11,65"
